package xyz.wpxy.iotlink.network.mqtt.server.service;

import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import xyz.wpxy.iotlink.network.core.entity.DeviceDataEntity;
import xyz.wpxy.iotlink.network.mqtt.server.BaseMqttMessageServer;

/**
 * Mqtt消息处理
 */
@Slf4j
@Component
@AllArgsConstructor
public class MqttMessageProcess extends BaseMqttMessageServer {

    /**
     * 消息处理
     *
     * @param topic   非/标准topic
     * @param content 内容体
     */
    public void receive(String topic, String content) {
        if (isStandardTopic(topic)) {
            String[] ary = topic.split("/");
            String productSn = ary[2];
            String gatewaySn = ary[3];
            String type = ary[4];
            DeviceDataEntity deviceDataEntity = JSONObject.parseObject(content, DeviceDataEntity.class);

        }

    }

}
